import {defineConfig} from "vitepress";

import {CPPMenu} from "./menus/cpp-menu";
import {StmMenu} from "./menus/stm-menu";
import {RTOSMenu} from "./menus/rtos-menu.js";
import {LinuxMenu} from "./menus/linux-menu";
import {HardwareMenu} from "./menus/hardware-menu.js";
import {PrjsMenu} from "./menus/prjs-menu";


import {MainNav} from "./main-nav";

import mathjax3 from "markdown-it-mathjax3";

const customElements = [
  "math",
  "maction",
  "maligngroup",
  "malignmark",
  "menclose",
  "merror",
  "mfenced",
  "mfrac",
  "mi",
  "mlongdiv",
  "mmultiscripts",
  "mn",
  "mo",
  "mover",
  "mpadded",
  "mphantom",
  "mroot",
  "mrow",
  "ms",
  "mscarries",
  "mscarry",
  "mscarries",
  "msgroup",
  "mstack",
  "mlongdiv",
  "msline",
  "mstack",
  "mspace",
  "msqrt",
  "msrow",
  "mstack",
  "mstack",
  "mstyle",
  "msub",
  "msup",
  "msubsup",
  "mtable",
  "mtd",
  "mtext",
  "mtr",
  "munder",
  "munderover",
  "semantics",
  "math",
  "mi",
  "mn",
  "mo",
  "ms",
  "mspace",
  "mtext",
  "menclose",
  "merror",
  "mfenced",
  "mfrac",
  "mpadded",
  "mphantom",
  "mroot",
  "mrow",
  "msqrt",
  "mstyle",
  "mmultiscripts",
  "mover",
  "mprescripts",
  "msub",
  "msubsup",
  "msup",
  "munder",
  "munderover",
  "none",
  "maligngroup",
  "malignmark",
  "mtable",
  "mtd",
  "mtr",
  "mlongdiv",
  "mscarries",
  "mscarry",
  "msgroup",
  "msline",
  "msrow",
  "mstack",
  "maction",
  "semantics",
  "annotation",
  "annotation-xml",
  "mjx-container",
  "mjx-assistive-mml",
];

export default {
  markdown: {
    config: (md) => {
      md.use(mathjax3);
    },
  },
  vue: {
    template: {
      compilerOptions: {
        isCustomElement: (tag) => customElements.includes(tag),
      },
    },
  },

  title: "嵌入式小册",
  themeConfig: {
    aside: true,
    outline: "deep",
    outlineBadges: true,
    outlineTitle: "目录",
    lang: "zh-CN",
    logo: "/icons/index.svg",
    siteTitle: "嵌入式小册",
    lastUpdated: true,
    nav: MainNav, // 导航抽离
    socialLinks: [
      {icon: "github", link: "https://github.com/zhillerdev"},
      {icon: "discord", link: "https://discord.gg/Qs4Mtr23QG"},
    ],
    footer: {
      message: "Released under the undefined License.",
      copyright: "Copyright © 2024-present Zhiller",
    },
    algolia: {
      appId: "R2IYF7ETH7",
      apiKey: "599cec31baffa4868cae4e79f180729b",
      indexName: "index",
    },
    docFooter: {
      prev: "上一篇文章",
      next: "下一篇文章",
    },

    // 侧边栏抽离
    sidebar: {
      "/cpp/": CPPMenu,
      "/stm/": StmMenu,
      "/rtos/": RTOSMenu,
      "/linux/": LinuxMenu,
      "/prjs/": PrjsMenu,
      "/hardware/":HardwareMenu,
    },
  },

  cleanUrls: true,
};

// // https://vitepress.dev/reference/site-config
// export default defineConfig({
//   title: "ZhillerBlog",
//   description: "zhiller的博客",
//   themeConfig: {
//     // https://vitepress.dev/reference/default-theme-config
//     nav: [
//       { text: 'Home', link: '/' },
//       { text: 'Cpp', link: '/cpp' },
//       { text: 'STM', link: '/stm' },
//       { text: 'Linux', link: '/linux' },
//       { text: 'Project', link: '/prj' },
//       { text: 'Java', link: '/java' }
//     ],

//     sidebar: [
//       {
//         text: 'C/C++',
//         items: [
//           { text: 'Markdown Examples', link: '/markdown-examples' },
//           { text: 'Runtime API Examples', link: '/api-examples' }
//         ]
//       },
//       {
//         text: 'Examples',
//         items: [
//           { text: 'Markdown Examples', link: '/markdown-examples' },
//           { text: 'Runtime API Examples', link: '/api-examples' }
//         ]
//       }
//     ],

//     socialLinks: [
//       { icon: 'github', link: 'https://github.com/zhillerdev' },
//     ]
//   }
// })
